/******************************************************************************
* SVN­Version­Information:
* ­­­­­­­­­­­­­­­­­­­­­­­­---------------------
* $LastChangedRevision: 6 $
* $LastChangedBy: c.a.duevel $
* $LastChangedDate: 2009-08-26 15:12:37 +0000 (Wed, 26 Aug 2009) $
* $HeadURL: http://robofight.googlecode.com/svn/trunk/ClientJavaFX/src/de/hft_stuttgart/robofight/client/javafx/util/Tooltip.fx $
******************************************************************************/

package de.hft_stuttgart.robofight.client.javafx.util;

import javafx.ext.swing.SwingLabel;
import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import de.hft_stuttgart.robofight.client.javafx.Constants;

/**
 * @author ralf.dauenhauer@gmx.de
 */

/**
 * Tooltip contains of a rectangle and a swinglabel
 */
public class Tooltip extends CustomNode {
    public var text:String;
    public var x: Integer;
    public var y: Integer;
//    var opac : Integer;

    var label : SwingLabel;
//    public def tipEffect:Timeline = Timeline {
//        keyFrames: [
//            at (0s) {
//            opac => 0.3;
//            },
//            at (3s) {
//                opac => 0.7 tween Interpolator.EASEBOTH;
//            },
//        ]
//    }

   
    var tooltip = Group {
            translateX : bind x , translateY: bind y
//            opacity: bind opac
            content: [
                Rectangle {
                    fill: Color.GRAY
                    width: bind label.boundsInLocal.width 
                    height: 20
                    arcWidth: 15, arcHeight: 15
                },
                label = SwingLabel {
                    translateX : 5 , translateY: 4
                    text: bind text
                    width : 300
                    height : 12
                    font: Constants.FONT_TOOLTIP
                }
            ]
    }
    

    override function create() : Node {
        return tooltip;
    }
}

